#include <algorithm>
#include <cstdio>
using namespace std;

int t, a, b, c;
inline bool check(int p) {
	int ra = a - p, rb = b - p, rc = c;
	return ra >= 0 && rb >= 0 && ra + rb >= p / 2 && ra + rc >= p / 2 && rb + rc >= p / 2;
}
int main() {
	// freopen("testdata.in", "r", stdin);
	// freopen("testdata.out", "w", stdout);
	freopen("store.in", "r", stdin);
	freopen("store.out", "w", stdout);
	scanf("%d", &t);
	while (t--) {
		scanf("%d%d%d", &a, &b, &c);
		int l = 0, r = (a + b + c) / 3, mid = 0;
		while (l <= r) {
			mid = (l + r) >> 1;
			if (check(mid))
				l = mid + 1;
			else {
				r = mid - 1;
			}
		}
		printf("%d\n", l - 1);
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}